#include "EventLoop.h"

EventLoop::EventLoop()
    : epfd_(new Epoll)
{
}

EventLoop::~EventLoop()
{
    delete epfd_;
}

std::vector<Channel *> EventLoop::run()
{
    while (true)
    {
        std::vector<Channel *> channels = epfd_->loop();
        for (auto &ch : channels)
        {
            ch->handleevent();
        }
    }
}

 Epoll* EventLoop::getEpfd()
{
    return epfd_;
}
